package desiginmodel.observe;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Administrator
 * 女孩是观察者的目标
 */
public class BeautifulGirl implements Target{
	/**
	 * 所有观察者
	 */
	private List<Observer> boys = new ArrayList<>();
	/**
	 * 婚姻状态
	 */
	private String maritalStatus;
	@Override
	public void notifyAllObservers() {
		for (Observer boy : boys) {
			boy.update();
		}
	}
	@Override
	public void attach(Observer boy) {
		this.boys.add(boy);
	}
	public String getMaritalStatus() {
		return maritalStatus;
	}
	public void setMaritalStatus(String maritalStatus) {
		this.maritalStatus = maritalStatus;
		this.notifyAllObservers();
	}
	@Override
	public String getState() {
		return this.getMaritalStatus();
	}
	@Override
	public void setState(String state) {
		this.setMaritalStatus(state);
	}
}
